package com.smartwebee.android.blespp.utils;

import android.content.Context;
import android.support.constraint.ConstraintLayout;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;

import com.smartwebee.android.blespp.R;
import com.smartwebee.android.blespp.hospital.BaseActivity;

public class HttpLoading extends ConstraintLayout {
    private TextView tvDesc;
    private ProgressBar progressBar;
    private ImageView imgClose;
    private BaseActivity.LoadingDismissEvent event;
    public HttpLoading(Context context) {
        this(context, null);
    }

    public HttpLoading(Context context, AttributeSet attrs) {
        super(context, attrs);
        LayoutInflater.from(context).inflate(R.layout.http_loading, this, true);
        initView();
        addXmlAttrs(context, attrs);
    }

    private void addXmlAttrs(Context context, AttributeSet attrs) {

    }

    private void initView() {
        tvDesc = (TextView)findViewById(R.id.tv_desc);
        progressBar = (ProgressBar)findViewById(R.id.progress_bar);
        imgClose = (ImageView)findViewById(R.id.img_close);
    }

    public ImageView getImgClose() {
        return imgClose;
    }

    public void setImgClose(ImageView imgClose) {
        this.imgClose = imgClose;
    }

    public void setDesc(String desc) {
        tvDesc.setText(desc);
    }

    public void setProgress(int progress) {
        progressBar.setProgress(progress);
    }

    public BaseActivity.LoadingDismissEvent getEvent() {
        return event;
    }

    public void setEvent(BaseActivity.LoadingDismissEvent event) {
        this.event = event;
    }
}
